<?php
/**
 * Zeed Platform Project
 * Based on Zeed Framework & Zend Framework.
 *
 * LICENSE
 * http://www.zeed.com.cn/license/
 *
 * @category Zeed
 * @package Zeed_ChangeMe
 * @subpackage ChangeMe
 * @copyright Copyright (c) 2010 Zeed Technologies PRC Inc. (http://www.zeed.com.cn)
 * @author Zeed Team (http://blog.zeed.com.cn)
 * @since 2010-12-6
 * @version SVN: $Id$
 */
class WorkbenchAdminAbstract extends AdminAbstract
{
    /**
     * 处理操作结果的文件名
     *
     * @param string $title 原标题
     * @param string $action_type 操作类型
     * @return string
     */
    public function renameTitle($title, $action_type = null)
    {
        /* 定义操作类型 */
        if ($action_type == 'clip_video') {
            $title_suffix = '_录像截短';
        } elseif ($action_type == 'clip_audio') {
            $title_suffix = '_录音截短';
        } elseif ($action_type == 'clip_video_image') {
            $title_suffix = '_录像截图';
        } elseif ($action_type == 'audio_operate') {
            $title_suffix = '_录音处理';
        } elseif ($action_type == 'image_operate') {
            $title_suffix = '_图像处理';
        } else {
            $title_suffix = '';
        }

        /* 处理标题 */
        $title_new = $title;
        if ($title_suffix) {
            $title_arr = explode('.', $title);
            $suffix = $title_arr[count($title_arr) - 1];
            $title_arr[count($title_arr) - 1] = $title_suffix;
            if ($action_type == 'clip_video_image') {
                $title_arr[count($title_arr)] = 'jpg';
            } else {
                $title_arr[count($title_arr)] = $suffix;
            }
            $title_new = implode('.', $title_arr);
            $title_new = str_replace('.' . $title_suffix, $title_suffix, $title_new);
        }

        return $title_new;
    }
}

// End ^ Native EOL ^ UTF-8